//
//  UITextField+KNLeftView.m
//  Concubine
//
//  Created by ... on 16/7/7.
//  Copyright © 2016年 dengyun. All rights reserved.
//

#import "UITextField+KNLeftView.h"
#import "NSString+Size.h"

@implementation UITextField (KNLeftView)

- (void)placeHolderTitle:(NSString *)title {
    self.leftViewMode = UITextFieldViewModeAlways;
    self.layer.borderWidth = 1.0;
    self.layer.borderColor = JJ_RGB(26.0f, 26.0f, 26.0f).CGColor;
    UIFont *labFont = [UIFont systemFontOfSize:14.0];
    CGFloat kWidth = [title widthWithFont:labFont constrainedToHeight:self.height];
    UIView * bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kWidth + 12, self.height)];  //手机号
    self.leftView = bgView;
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, kWidth+2, self.height)];    //因为证字 要距离左边有14的距离，所以label
    label.text = title;
    label.textAlignment=  NSTextAlignmentLeft ;
    label.textColor = JJ_RGB(26.0f, 26.0f, 26.0f);
    label.font = labFont;
    [bgView addSubview:label];
}


@end
